/**
 * Created by cuppi on 2017/6/8.
 */
import axios from 'axios';
import GlobalConstant from '../util/GlobalConstant';
class Network {
  static activityInfotimes() {
    return new Promise((resolve, reject) => {
      axios.post(GlobalConstant.baseUrl + '/activityInfo/times', {}, {
        headers: {
          'Content-Type': 'application/x-www-form-urlencoded'
        }
      }).then(data => {
        resolve(data.data.data);
      }, error => {
        reject(error);
      });
    });
  }
  static cityByCoordinate(cityList) {
    let longitude = cityList.longitude;
    let latitude = cityList.latitude;
    return new Promise((resolve, reject) => {
      axios.post(GlobalConstant.baseUrl + '/location/city', {}, {
        params: {longitude, latitude},
        headers: {
          'Content-Type': 'application/x-www-form-urlencoded'
        }
      }).then(data => {
        resolve(data.data.data);
      }, error => {
        reject(error);
      });
    });
  }
}
export default Network;
